package com.seuic.hnjiningposapp.hnapps.ui.view.dialog;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.lxj.xpopup.core.BasePopupView;
import com.seuic.hnjiningposapp.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * 现金汇款成功
 */
public class CashRemittanceSuccessPp extends BasePopupView {
    Unbinder bind;
    @BindView(R.id.switch_success_name)
    TextView switchSuccessName;
    @BindView(R.id.switch_success_usernum)
    TextView switchSuccessUsernum;
    @BindView(R.id.switch_success_usernmae)
    TextView switchSuccessUsernmae;
    @BindView(R.id.switch_success_dealtype)
    TextView switchSuccessDealtype;
    @BindView(R.id.p_namelayout)
    RelativeLayout pNamelayout;
    @BindView(R.id.switch_success_money)
    TextView switchSuccessMoney;
    @BindView(R.id.deal_money_layout)
    RelativeLayout dealMoneyLayout;
    @BindView(R.id.switch_success_okbtn)
    Button switchSuccessOkbtn;
    CashRemittanceSuccess mCashRemittanceSuccess;

    public CashRemittanceSuccessPp(@NonNull Context context, CashRemittanceSuccess cashRemittanceSuccess) {
        super(context);
        this.mCashRemittanceSuccess = cashRemittanceSuccess;
    }

    @Override
    protected int getPopupLayoutId() {
        return R.layout.switch_success_layout;
    }

    String name;
    String num;
    String username;
    String money;

    public void setName(String name) {
        this.name = name;
    }

    public void setNum(String num) {
        this.num = num;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setMoney(String money) {
        this.money = money;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        bind = ButterKnife.bind(this);
        pNamelayout.setVisibility(View.GONE);
        switchSuccessName.setText(name);//操作名称
        switchSuccessUsernum.setText(num);//卡号
        switchSuccessUsernmae.setText(username);//用户姓名
        switchSuccessMoney.setText(money);//交易金额
    }

    @OnClick(R.id.switch_success_okbtn)
    public void onViewClicked() {
        mCashRemittanceSuccess.CashRemittance();
    }

    public interface CashRemittanceSuccess {
        void CashRemittance();
    }

    @Override
    protected void onDismiss() {
        super.onDismiss();
        //注解解绑
        if (bind != null && bind != Unbinder.EMPTY) {
            bind.unbind();
        }
        this.bind = null;
    }

}
